-- deadly_damage
-- create by panyl
-- 道具：  致命伤害

return {
    apply = function(source, target, classId, value)
        -- 致命伤害

        -- 传入攻击者信息
        local assailantInfo = {
            ["property_id"] = classId,
        };

        -- 计算致命一击的伤害
        value = FormulaM.invoke("CALC_PROPERTY_DEADLY_DAMAGE", classId, target);

        -- 修正伤害值
        value = PropertyM.fixPropertyDamage(source, target, classId, value);

        if ItemM.query(classId, "apply") == "damage_and_drop" then
            -- 会掉落道具
            CombatM.doDamage(source, target, value, 0, true, { assailantInfo = assailantInfo, });
        else
            CombatM.doDamage(source, target, value, 0, false, { assailantInfo = assailantInfo, });
        end

        -- 抛出使用道具攻击事件
        EventMgr.fire(event.PROPERTY_ATTACK, { ["classId"] = classId, ["target"] = target, });
    end,
};
